import discord
import os
import asyncio
import command
import time
import sys

PREFIX = ">"


#reading private stuff from file
#If you run this bot yourself you have to create this file yourself.


client = discord.Client()

@client.event
async def on_message(message):
	# we do not want the bot to reply to itself
	if message.author == client.user:
		return
	if message.content.startswith(PREFIX):
		await command.handle_command(client, message)

@client.event
async def on_ready():
	print('Logged in as')
	print(client.user.name)
	print(client.user.id)
	print('------')
	command.servers.client = client
	await command.init_updater()


#reading token from file
dirname, filename = os.path.split(os.path.abspath(__file__))
ref = open(dirname + "/private.ref", 'r')
TOKEN = str.strip(ref.readline())
ref.close()

client.run(TOKEN)
